-
Notifications
You must be signed in to change notification settings - Fork 291
✨ Make bootMACAddress optional for virtual media with inspection enabled #2793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hi @donpenney. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
I'm not sure I understand the link between PreprovisioningNetworkDataName and BootMacAddress. Honestly, I suggest just dropping the requirement on BootMacAddress for virtual media based drivers. |
Thanks @dtantsur . I was aiming to be a bit surgical here to minimize behavoural changes. My thinking was that if the network config has been provided in an nmstate secret as part of the initial configuration, then the BootMacAddress was unnecessary for the inspection stage. I assumed it would always be the case for inspection with virtual media, but hadn't thought about using that as the determining factor, so I'll go that route instead. |
|
For background: since quite some time, the Ironic inspection implementation for Redfish is actually hybrid: it starts with getting MAC addresses from Redfish, then reboots into the agent ramdisk. Now that I said that, I think we should still require BootMacAddress if inspection is disabled on the BMH @donpenney. |
dcd4003 to
da22bd4
Compare
internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go
Outdated
Show resolved
Hide resolved
internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go
Outdated
Show resolved
Hide resolved
|
/ok-to-test |
|
/lgtm |
Virtual media BMC drivers (redfish-virtualmedia, idrac-virtualmedia, ilo5-virtualmedia) can boot from virtual media and discover the MAC address during hardware inspection. Therefore, bootMACAddress is optional when inspection is enabled but still required when inspection is disabled (since there's no other way to discover the MAC address). This change updates the virtual media driver implementations to return false from their NeedsMAC() methods, and adds validation logic to require bootMACAddress when virtual media is used with inspection disabled. Drivers that require PXE boot (like libvirt, ipmi) continue to require bootMACAddress in all cases. Changes: - pkg/hardwareutils/bmc/redfish_virtualmedia.go: NeedsMAC() returns false - pkg/hardwareutils/bmc/idrac_virtualmedia.go: NeedsMAC() returns false - internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go: Add logic to require bootMACAddress for virtual media when inspection is disabled (via InspectionMode field or inspect.metal3.io annotation) - pkg/provisioner/ironic/ironic.go: Skip MAC-based port queries when bootMACAddress is empty to prevent false MAC conflicts Test Coverage: - internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation_test.go: * bootMACAddress not required for virtual media with inspection enabled * bootMACAddress required for virtual media with inspection disabled * bootMACAddress valid when provided for virtual media with inspection disabled - pkg/hardwareutils/bmc/access_test.go: Update virtual media test expectations (needsMac: false) Assisted-By: Claude <[email protected]> Signed-off-by: Don Penney <[email protected]>
Changes:
1. Restore case-insensitive MAC comparison using strings.EqualFold()
- The EqualFold check was removed inadvertently but is necessary for
case-insensitive bootMACAddress validation
2. Use existing host.InspectionDisabled() method
- Remove duplicate isInspectionDisabled() function
- Replace custom implementation with the existing BareMetalHost method
- The host.InspectionDisabled() method provides identical functionality
Assisted-by: Claude (AI Assistant)
Signed-off-by: Don Penney <[email protected]>
d3d109c to
a827cd6
Compare
|
Rebased my branch and removed a change to a test case that had been failing in my env due to running with golang 1.24.5. The format of an url.Parse error message changed in 1.24.9. Because my golang was older, the test was failing in my environment. I have now removed this unrelated change from my update |
internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go
Outdated
Show resolved
Hide resolved
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dtantsur The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Simplify the conditional logic for determining when a MAC address is required. The new approach uses a single boolean expression instead of separate assignment and conditional check, improving code readability while maintaining the same functionality. Assisted-by: Claude (AI Assistant) Signed-off-by: Don Penney <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR makes the bootMACAddress field optional for virtual media BMC drivers (redfish-virtualmedia, idrac-virtualmedia, ilo5-virtualmedia) when hardware inspection is enabled, while still requiring it when inspection is disabled or for PXE-based drivers that always need the MAC address.
Key Changes:
- Virtual media drivers can now boot and discover the MAC address during inspection, eliminating the requirement to pre-configure
bootMACAddress - PXE-based drivers (libvirt, ipmi) continue to require
bootMACAddressin all cases - Enhanced validation logic properly handles the conditional requirement based on driver type and inspection status
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/hardwareutils/bmc/redfish_virtualmedia.go | Updated NeedsMAC() to return false for redfish-virtualmedia and ilo5-virtualmedia drivers |
| pkg/hardwareutils/bmc/idrac_virtualmedia.go | Updated NeedsMAC() to return false for idrac-virtualmedia driver |
| pkg/hardwareutils/bmc/access_test.go | Updated test expectations to reflect that virtual media drivers no longer need MAC by default |
| internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation.go | Added conditional MAC requirement logic: requires MAC when driver needs it OR when inspection is disabled |
| internal/webhooks/metal3.io/v1alpha1/baremetalhost_validation_test.go | Added test coverage for virtual media with/without inspection, added blank import for BMC driver registration |
| internal/webhooks/metal3.io/v1alpha1/baremetalhost_webhook_test.go | Added test case for libvirt driver requiring MAC address |
| pkg/provisioner/ironic/ironic.go | Skips MAC-based port lookup when bootMACAddress is empty to prevent false conflict detection |
| pkg/provisioner/ironic/findhost_test.go | Added tests verifying no port queries occur when MAC is empty |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/lgtm |
Virtual media BMC drivers (redfish-virtualmedia, idrac-virtualmedia,
ilo5-virtualmedia) can boot from virtual media and discover the MAC
address during hardware inspection. Therefore, bootMACAddress is optional
when inspection is enabled but still required when inspection is disabled
(since there's no other way to discover the MAC address).
This change updates the virtual media driver implementations to return
false from their NeedsMAC() methods, and adds validation logic to require
bootMACAddress when virtual media is used with inspection disabled.
Drivers that require PXE boot (like libvirt, ipmi) continue to require
bootMACAddress in all cases.
Changes:
Add logic to require bootMACAddress for virtual media when inspection
is disabled (via InspectionMode field or inspect.metal3.io annotation)
bootMACAddress is empty to prevent false MAC conflicts
Test Coverage:
Update virtual media test expectations (needsMac: false)
Assisted-By: Claude [email protected]
Checklist: